package containers;
import java.util.*;
import static net.mindview.util.Print.*;
public class ListSortSearch {
    public static void main(String[] args) {
        List<String> list=new ArrayList<String>(Utilities.list);
        print(list);
        Collections.shuffle(list,new Random(47));
        print("Shuffered: "+list);
        ListIterator<String> it=list.listIterator(5);
        while(it.hasNext()){
            it.next();
            it.remove();
        }
        print("Trimed: "+list);
        Collections.sort(list);
        print("Sorted: "+list);
        String key=list.get(3);
        int index=Collections.binarySearch(list,key);
        print("Location of "+key+"is "+index+", list.get("+index+") = "+list.get(index));
        Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
        print("Case-insenitive sorted: "+list);
        key=list.get(3);
        index=Collections.binarySearch(list,key,String.CASE_INSENSITIVE_ORDER);
        print("Location of "+key+"is "+index+", list.get("+index+") = "+list.get(index));
    }
}
